import kotlinx.coroutines.*

fun main()= runBlocking {
    switchIO(CoroutineExceptionHandler { coroutineContext, throwable ->  }){
        println(Thread.currentThread().name+"--------------")
        println(this)
    }
   delay(1000)
}
fun switchIO(
    handler: CoroutineExceptionHandler,
    block: suspend CoroutineScope.() -> Unit
): Job {
    return GlobalScope.launch(Dispatchers.IO + handler) {
        println("${this}--------------")
        block()
    }
}